package com.etone.smartAudit.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.etone.smartAudit.domain.AuditExceptionType;
import com.etone.smartAudit.error.CustomParameterizedException;
import com.etone.smartAudit.mapper.AuditExceptionTypeMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: sovy
 * @date: 2020/9/29
 * @description:
 */

@Service
public class AuditExceptionTypeService extends ServiceImpl<AuditExceptionTypeMapper, AuditExceptionType> {

    /**
     * 审计点详情
     *
     * @param id
     * @return
     */
    public AuditExceptionType get(Integer id) {
        AuditExceptionType auditExceptionType = baseMapper.selectById(id);
        if (auditExceptionType == null) {
            throw new CustomParameterizedException("审计点不存在");
        }
        return auditExceptionType;
    }

    public List<AuditExceptionType> getList(Integer specialId) {
        return baseMapper.selectList(new QueryWrapper<AuditExceptionType>().eq("intSpecialId",specialId));
    }
}
